namespace IAM.Interface.Model
{
    using IAM.Interface.Model.Interface;
    using System;
    using System.Collections;
    using System.Text;
    using System.Xml;

    public class Logs : AbstractConvertObject, IConvertXml
    {
        private ArrayList _logs = new ArrayList();

        public override object ConvertToObject()
        {
            foreach (XmlNode xn in this.CurrentXmlNode.ChildNodes)
            {
                Log log = new Log();
                log.CurrentXmlNode = xn;
                log = (Log) log.ConvertToObject();
                this.Items.Add(log);
            }
            return this;
        }

        public int Count
        {
            get
            {
                return this.Items.Count;
            }
        }

        public ArrayList Items
        {
            get
            {
                return this._logs;
            }
            set
            {
                this._logs = value;
            }
        }

        public string XML
        {
            get
            {
                return (this.XMLBoday + this.XMLFinis);
            }
        }

        public string XMLBoday
        {
            get
            {
                StringBuilder _xml = new StringBuilder();
                _xml.Append("<Logs");
                _xml.Append(" Count=\"" + this.Count + "\"");
                _xml.Append(" >");
                foreach (object item in this.Items)
                {
                    _xml.Append(((Log) item).XML);
                }
                return _xml.ToString();
            }
        }

        public string XMLFinis
        {
            get
            {
                return "</Logs>";
            }
        }
    }
}

